import xml.dom.minidom
import wxpyview.ui.core.dataprovider.common.array
import wxpyview.ui.core.dataprovider.common.tree

class BaseDataProvider:
    def __init__(self):
        self.data = None

    def _parseProviderDom(self, dom):
        if dom.nodeType != dom.ELEMENT_NODE:
            raise IOException
        
        if dom.nodeName != "wx:dataProvider":
            raise IOException
        
        if dom.childNodes[1].nodeName == "wx:ArrayCollection":
            self.data = wxpyview.ui.core.dataprovider.common.array.getData(dom.childNodes[1])

        if dom.childNodes[1].nodeName == "wx:TreeCollection":
            self.data = wxpyview.ui.core.dataprovider.common.tree.getData(dom.childNodes[1])

    def getData(self):
        return self.data